﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace STMS.WSTMSystem.UControls
{
        [DefaultEvent("Click")]
        public partial class UMenuButton : UserControl
        {
                public UMenuButton()
                {
                        InitializeComponent();

                }

                public Image BtnImg
                {
                        get { return this.pbImg.Image; }
                        set
                        {
                                this.pbImg.Image = value;
                                this.Invalidate();
                        }
                }

                public string BtnText
                {
                        get { return this.lblBtnText.Text; }
                        set
                        {
                                this.lblBtnText.Text = value;
                                this.Invalidate();
                        }
                }

                public Color BgColor
                {
                        get { return this.BackColor; }
                        set
                        {
                                this.BackColor = value;

                        }
                }


                protected override void OnMouseClick(MouseEventArgs e)
                {

                        base.OnMouseClick(e);
                        this.BgColor = Color.FromArgb(88, 116, 216);

                }

                protected override void OnMouseEnter(EventArgs e)
                {
                        base.OnMouseEnter(e);
                        this.BgColor = Color.FromArgb(88, 116, 216);
                }

                protected override void OnMouseLeave(EventArgs e)
                {
                        base.OnMouseLeave(e);
                        this.BgColor = Color.FromArgb(45, 50, 116);
                }

                private void pbImg_Click(object sender, EventArgs e)
                {
                        base.OnClick(e);
                }

                private void lblBtnText_Click(object sender, EventArgs e)
                {
                        base.OnClick(e);
                }

                private void pbImg_MouseEnter(object sender, EventArgs e)
                {
                        OnMouseEnter(e);
                }

                private void lblBtnText_MouseEnter(object sender, EventArgs e)
                {
                        OnMouseEnter(e);
                }
        }
}
